
#include <iostream>
#include <unistd.h>
#include <any>
#include <cassert>


#include <iostream>
#include <typeinfo>
#include <cassert>
#include <unistd.h>

#include "../source/Any.hpp"
#include "../source/EventLoop.hpp"
#include "../source/Timerwheel.hpp"
#include "../source/Connect.hpp"
#include "../source/Server.hpp"

void print(int n){
    std::cout<<"任务"<<n<<std::endl;
}
void test1()
{
    EventLoop ELoop;
    TimerWheel tw(&ELoop);
    tw.TimerAdd(1,5,std::bind(print,1));
    tw.TimerAdd(2,6,std::bind(print,2));
    
    tw.TimerCancel(1);
    
}


class Test{
    public:
        Test() {std::cout << "构造" << std::endl;}
        Test(const Test &t) {std::cout << "拷贝" << std::endl;}
        ~Test() {std::cout << "析构" << std::endl;}
};

void test2()
{
    
    
    Any a;
    {
        Test t;
        a = t;
    }
    
    a = 10;
    int *pa = a.get<int>();
    std::cout << *pa << std::endl;
    a = std::string("nihao");
    std::string *ps = a.get<std::string>();
    std::cout << *ps << std::endl;
    
    while(1) sleep(1);
   
}
int main()
{
    //test1();
    test2();
    return 0;
}